package com.atguigu.lease.web.admin.custom.config;

import com.atguigu.lease.web.admin.custom.converter.StringToBaseEnumConverterFactory;
import com.atguigu.lease.web.admin.custom.converter.StringToItemtypeConverter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.format.FormatterRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebMvcConfiguration implements WebMvcConfigurer {

    //手写的转换器 交付给mvc知道
    @Autowired
    private StringToBaseEnumConverterFactory factory;
    //private StringToItemtypeConverter itemtypeConverter;



    @Override
    public void addFormatters(FormatterRegistry registry) {
       // registry.addConverter(itemtypeConverter);
        //这是但是枚举类的转换器
       registry.addConverterFactory(factory);
    }
}
